<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.transcargo.users.Contact" %>
<%@ page import="com.transcargo.users.User" %>
<%@ page import="com.transcargo.users.Transport" %>
<%@ page import="com.transcargo.errors.ErrorList" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.StringTokenizer" %>
<%@include file="header.jsf"%>
<%@include file="session.jsf"%>
<%
    if (User_Id <= 0) {
        response.sendRedirect("auth.jsp");
        return;
    }
    
    String id = request.getParameter("id");
    if (id == null || Integer.parseInt(id) == 0) {
    	response.sendRedirect("user.jsp");
    	return;
    }
    int Id = Integer.parseInt(id);
    Transport trans = user.getTransport(Id);
    if (trans == null) {
    	response.sendRedirect("trucks.jsp");
    	return;
    }
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  	<head><title>TransCargo</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="forms.js"></script>
	<link type="text/css" href="transcargo.css" rel="stylesheet"/>
  </head>
  <body>
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr><td>
			<%@include file="page_header.jsf"%>
        </td></tr>
        <tr><td align="center">
            Укажите название для добавляемого транспорта<br><br>
			<div id="ErrorPlaceHolder" class="errorString"></div>
            <form action="EditTruckNameAction" method="POST" target="ifPost">
			<input name="id" type="hidden" value="<%=Id%>">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr class="tdFormSearch"><td>Название:</td><td align="left"><input name="name" size="20" value="<%=trans.getName()%>"></td></tr>
                <tr><td class="tdFormSearch">Тип транспорта:</td><td align="left"><%=trans.getSType(dbase)%></td></tr>
                <tr><td class="tdFormSearch">Тип загрузки:</td><td align="left">
                    <%
                        String[] loads = trans.getSLoading(dbase);
                        for (int i = 0; i < loads.length; i++) {
                            out.print(loads[i] + "<br>");
                        }
				%>
                </td></tr>
                <tr class="tdFormSearch"><td>Объем:</td><td align="left"><%=trans.getVolume()%> м<sup>3</sup></td></tr>
                <tr class="tdFormSearch"><td>Тоннаж:</td><td align="left"><%=trans.getTonnage()%> т.</td></tr>
<% if (trans.getHeight() > 0) {
%>                <tr class="tdFormSearch"><td>Высота:</td><td align="left"><%=trans.getHeight()%> м.</td></tr> <% } %>
<% if (trans.getLength() > 0) {
%>                <tr class="tdFormSearch"><td>Длина:</td><td align="left"><%=trans.getLength()%> м.</td></tr> <% } %>
<% if (trans.getWidth() > 0) {
%>                <tr class="tdFormSearch"><td>Ширина:</td><td align="left"><%=trans.getWidth()%> м.</td></tr> <% } %>
<% if (trans.getTIR()) {
%>                <tr class="tdFormSearch"><td>TIR Carnet:</td><td align="left"><input type="checkbox" checked disabled></td></tr> <% } %>
<% if (trans.getEKMT()) {
%>                <tr class="tdFormSearch"><td>EKMT:</td><td align="left"><input type="checkbox" checked disabled></td></tr> <% } %>
<% if (trans.getADR() > 0) {
%>                <tr class="tdFormSearch"><td>Класс ADR:</td><td align="left"><%=trans.getADR()%></td></tr> <% } %>
                <tr><td align="center" align="right"><input type="submit" value="Продолжить"></form></td><td align="left"><input type="submit" value="Вернуться к списку" onclick="window.location='trucks.jsp';"></td></tr>
            </table>
        </td></tr>
        </table>
	<iframe name="ifPost" id="ifPost" width="0" height="0" style="visibility: hidden;width: 0;height: 0;" onload="handlePost(this);"></iframe>

  </body>
</html>
